Make gtk_file_chooser_get_filter work for portal case
authorMichael Weghorn <m.weghorn@posteo.de>
Sat, 23 May 2020 12:37:24 +0000 (14:37 +0200)
committerMichael Weghorn <m.weghorn@posteo.de>
Tue, 9 Jun 2020 20:59:54 +0000 (22:59 +0200)
commitecc6c255efba2f779d06e434b5c10779d8972591
treec28c77195b8b562065c5cea4ad464abc1adf9fec
parent8cb50ac6e9c6a78f337e4ad2bb61aa0558844904
Make gtk_file_chooser_get_filter work for portal case

This makes 'gtk_file_chooser_get_filter' work for the
portal native file chooser by handling the corresponding
'current_filter' argument in the response retrieved via
D-Bus.

In order to try to map the retrieved 'current_filter' to one
of the existing list of filters, use the retrieved filter's name,
similar to how xdg-desktop-portal-gtk does it when evaluating the
'current_filter' input parameter in 'options'.)

Note: This depends on the following merge/pull requests
which fix the filter handling in gtk for native file choosers
and introduce the 'current_filter' handling for FileChooser portal.

* https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1959
* https://github.com/flatpak/xdg-desktop-portal/pull/493
* https://github.com/flatpak/xdg-desktop-portal-gtk/pull/311

This fixes #1820 for desktop portal case.

Fixes: #1820
gtk/gtkfilechoosernativeportal.c